import { createApp } from "vue";

import "@/assets/styles/index.scss"; // global css

import Cookies from "js-cookie";
import axios from "@/utils/request";

import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import locale from "element-plus/es/locale/lang/zh-cn";

import App from "./App.vue";
import store from "./store";
import router from "./router";

import "virtual:svg-icons-register";
import SvgIcon from "@/components/SvgIcon/index.vue";
import elementIcons from "@/components/SvgIcon/svgicon";

import "./permission"; // permission control
import plugins from "./plugins/index"; // plugins

import RightToolbar from "@/components/RightToolbar/index.vue";
import Editor from "@/components/Editor/index.vue";
import FileUpload from "@/components/FileUpload/index.vue";
import ImageUpload from "@/components/ImageUpload/index.vue";
import ImagePreview from "@/components/ImagePreview/index.vue";

import Avue from "@smallwei/avue";
import "@smallwei/avue/lib/index.css";
const app = createApp(App);
import AvueUeditor from "avue-plugin-ueditor";
app.component("FileUpload", FileUpload);
app.component("ImageUpload", ImageUpload);
app.component("ImagePreview", ImagePreview);
app.component("RightToolbar", RightToolbar);
app.component("Editor", Editor);

app.use(router);
app.use(store);
app.use(elementIcons);
app.component("svg-icon", SvgIcon);
app.use(plugins);
app.use(Avue, { axios });

app.use<any>(ElementPlus, {
  locale: locale,
  size: Cookies.get("size") || "default",
});
app.use(AvueUeditor);
app.config.globalProperties.$axios = axios;
app.mount("#app");
